package com.fcscs.cservice.domain.validator;

import com.fcscs.core.common.ErrorEnums;
import com.fcscs.core.domain.validator.BaseValidator;
import com.fcscs.cservice.domain.InRoomOrder;
import com.fcscs.cservice.domain.InRoomOrderItem;

public interface InRoomValidators {

	public static class InRoomOrderValidator extends BaseValidator<InRoomOrder> {

		public ErrorEnums validate(InRoomOrder entity, boolean newInstance) {
			ErrorEnums err = super.validate(entity, newInstance);
			if (err != null) {
				return err;
			} else {
				if (entity.getBillOptionId() < 1L || entity.getDeliveryTime() == null
						|| entity.getGuestProfileId() < 1L || entity.getReservationId() < 1L
						|| entity.getStatusEnum() == null) {
					return ErrorEnums.GeneralError.REQURIED_FLD_MISSING;
				}
			}
			return null;
		}

	}

	public static class InRoomOrderItemValidator extends BaseValidator<InRoomOrderItem> {

		public ErrorEnums validate(InRoomOrderItem entity, boolean newInstance) {
			ErrorEnums err = super.validate(entity, newInstance);
			if (err != null) {
				return err;
			} else {
				if (entity.getAmout() == null || entity.getAmout().doubleValue() < 0 || entity.getCategoryId() < 1L
						|| entity.getSubcategoryId() == null || entity.getChargeCategoryId() < 1L
						|| entity.getCount() < 1L || entity.getPriceCategoryEnum() == null || entity.getPrice() == null) {
					return ErrorEnums.GeneralError.REQURIED_FLD_MISSING;
				}
			}
			return null;
		}

	}

}
